﻿using ENail.Domain.Core;
using ENail.Domain.Core.Contract.Services;
using Equation.Enterprise.Framework.Domain.Data;
using Equation.Enterprise.Utilities.DesignByContract;

namespace ENail.ApplicationServices
{
    public class NailSalonService : INailSalonService
    {
        private readonly IRepository<NailSalon> _nailSalonRepository;

        public NailSalonService(IRepository<NailSalon> nailSalonRepository)
        {
            Check.Require(nailSalonRepository != null);

            this._nailSalonRepository = nailSalonRepository;
        }

        public NailSalon GetBasicInformation(int id)
        {
            Check.Require(id > 0);

            var nailSalon = _nailSalonRepository.Get(id);
            return nailSalon;
        }

        public int UpdateBasicInformation(NailSalon entity)
        {
            Check.Require(entity != null);

            _nailSalonRepository.Update(entity);
            return _nailSalonRepository.SaveChanges();
        }
    }
}
